#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main()
{








//umask(0);
    //int fd1 = open("log.txt", O_WRONLY | O_CREAT | O_TRUNC, 0666);//文件描述符
    //int fd1 = open("log1.txt", O_WRONLY | O_CREAT | O_APPEND, 0666);
    //int fd2 = open("log2.txt", O_WRONLY | O_CREAT | O_APPEND, 0666);
    //int fd3 = open("log3.txt", O_WRONLY | O_CREAT | O_APPEND, 0666);
    //int fd4 = open("log4.txt", O_WRONLY | O_CREAT | O_APPEND, 0666);
    //if(fd1 < 0)
    //{
    //    perror("open");
    //    return 1;
    //}
    //printf("fd1: %d\n", fd1);//3
    //printf("fd2: %d\n", fd2);//4
    //printf("fd3: %d\n", fd3);//5
    //printf("fd4: %d\n", fd4);//6

////const char *message = "hello write\n";
    //write(1, message, strlen(message));//可以直接向1里面写（1就是标准输出流）



    //int a = 12345;
    //char buffer[1024];
    //snprintf(buffer, sizeof(buffer), "%d", a);
    ////const char *m = "hello";
    //write(1, buffer, strlen(buffer));



    //printf("hello wrold\n");//标准输出的方式：显示屏上打印的内容
    //fputs("aaaa", stdout);
    //fwrite("bbbb", 1, 4, stdout);//1个字节，4个字符
    //fprintf(stdout, "cccc");//往stdout里打印




    //FILE *fp = fopen("log.txt", "a"); // 文件操作的步骤；打开，关闭；
    //if(fp == NULL)
    //{
    //    perror("fopen");
    //    return 1;
    //}

    //char buffer[1024];
    //const char *message = "hello bit";
    //int i = 0;
    //while(i < 10)
    //{
    //    snprintf(buffer, sizeof(buffer), "%s:%d\n", message, i);
    //    fputs(buffer, fp);
    //    i++;
    //}

    //fclose(fp);
    return 0;
}
